<!--
 * @Author: yangzhiyu yangzhiyu@mail.pigcms.com
 * @Date: 2024-03-29 16:56:47
 * @LastEditors: yangzhiyu yangzhiyu@mail.pigcms.com
 * @LastEditTime: 2024-04-01 16:27:39
 * @FilePath: \fe_user_pc\src\views\shotstack\MuseMixedCut\MixedCutPreview\components\saveVideoDialog.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
   音色选择
-->
<script setup>
import baseModel from "@/components/baseModel/baseModel.vue";
import { computed, onMounted, reactive, ref, nextTick, watch } from "vue";

import { message } from "ant-design-vue";

import {
    CaretRightOutlined,
    PauseOutlined,

} from "@ant-design/icons-vue";

const dialog = ref(null)


const emit = defineEmits(['update:data'])

const state = reactive({
    list: []
});


const useCart = (cart) => {
    emit('update', cart)
    closeModal()
}

const closeModal = () => {
    dialog.value.closeModal();
};

const showModal = (list) => {
    dialog.value.showModal();
    state.list = list
}
// 取消
const cancel = () => {
    closeModal();
};

defineExpose({
    showModal,
    closeModal,
});
</script>

<template>
    <div class="audition">
        <baseModel ref="dialog" :contentWidth="'754px'" minWidth="754px" :zIndex="9999"
            :getContainer="() => document.queryselector('.audition')">
            <!-- minWidth='1140px' -->

            <template #title>
                <div class="title_box"><span>选择试听音色</span></div>
            </template>
            <template #content>
                <div class="voice_cart_list">
                    <div v-for="(v2, index2) in state.list" :key="index2" class="voice_cart" @click="useCart(v2)">
                        <div class="voice_left">
                            <div class="imgBox">
                                <img :src="v2.img" alt="" />
                            </div>
                            <div class="described">
                                <span>{{ v2.name }}</span>
                                <span>{{ v2.human_style }}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </template>
            <template #footer>
                <div class="bottom">
                    <!-- <a-button class="btn" key="back" @click="cancel" style="margin-right: 10px">取消</a-button> -->
                    <a-button class="btn" key="submit" type="primary" @click="closeModal">取消</a-button>
                </div>
            </template>
        </baseModel>
    </div>
</template>

<style lang="less" scoped>
.voice_cart_list {
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    height: 550px;
    align-content: flex-start;
    justify-content: flex-start;

    // background-color: #5e2222;
    &::-webkit-scrollbar {
        width: 8px;
        /* 滚动条的宽度 */
        height: 10px;

    }

    &::-webkit-scrollbar-thumb {
        background: #888;
        /* 滑块的背景颜色 */
        border-radius: 10px;
        /* 滑块的圆角 */

    }

    :deep(.ant-popover-title) {
        display: none;
    }

    // 省略号编辑按钮
    .info-rg-more {
        cursor: pointer;
        font-size: 20px;
        padding: 1px 6px;
        border-radius: 3px;
        overflow: hidden;
        position: absolute;
        right: 10px;
        top: 10px;
        z-index: 999;

        &:hover {
            background-color: #0000002c;
        }
    }

    // 内部编辑的内容
    .item_config_change {
        display: flex;
        flex-direction: column;
        align-items: center;

        .is_self_parameter {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            margin-bottom: 15px;

            span {
                margin-right: 6px;
            }
        }

        .config_tag {
            align-self: flex-end;
            margin-right: 0;
            cursor: pointer;
        }

        .config_cart {
            width: 150px;
            margin-top: 15px;

            &:nth-child(2) {
                margin-top: 0;
            }

            .slider_box {
                display: flex;
                align-items: center;

                span {
                    font-size: 12px;
                    color: #727477;
                }

                .slider {
                    flex: 1;
                }
            }
        }
    }

    .voice_cart {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        width: 200px;
        height: 80px;
        border: 1px solid #e5e5e5;
        border-radius: 8px;
        cursor: pointer;
        margin-bottom: 15px;
        margin-right: 25px;
        position: relative;
        background-color: #fff;

        &:hover {
            background-color: #f9f9f9;

            .play_or_stop {
                opacity: 1 !important;
            }
        }

        &.active_voice_cart {
            border-color: #1664ff;
            background-color: #e8f4ff;
        }

        // 开启随机后的样式
        &.random_open {
            filter: grayscale(35%);
            opacity: 0.8;
        }

        .voice_left {
            display: flex;
            align-items: center;

            .described {
                display: flex;
                flex-direction: column;
            }

            .imgBox {
                position: relative;
                border-radius: 30px;
                overflow: hidden;
                margin-right: 20px;

                img {
                    width: 32px;
                }

                .play_or_stop {
                    position: absolute;
                    left: 0;
                    top: 0;
                    z-index: 1;
                    height: 100%;
                    width: 100%;
                    background-color: #b6b6b685;
                    text-align: center;
                    line-height: 32px;
                    font-size: 18px;
                    opacity: 0;
                    transition: opacity 0.3s;
                }
            }
        }
    }
}


.title_box {
    span {
        font-size: 18px;
        color: #0c0d0e;
    }
}
</style>
